<?php
include 'secure/core.php';

$SQL = "SELECT * FROM `gateway`";
$res = $ado->exec($SQL);
$row	=	$ado->fetch($res);
?>
<?php
if(isset($_POST['submit'])){
	$result = $admin->updateGateway($_POST);
	
	if($result == 1){
		header( 'Location: setup_gateway.php?msg=1' ) ;					
		exit;
	}
	else{
		header( 'Location: setup_gateway.php?msg=2' ) ;	
		exit;
	}		

}
include 'header.php';
include 'left.php'; 
?>
		<div id="right">
		<div class="section">
		<?php if($_GET['msg'] == '1') { ?>
		<div class="message green"><span><b>Success</b>: Gateway has been updated.</span></div>
		<?php } ?>
		<?php if($_GET['msg'] == '2') { ?>
		<div class="message red"><span><b>Error</b>: Error updating gateway.</span></div>
		<?php } ?>
				<div class="box">
					<div class="title">
						Setup Gateway
						<span class="hide"></span>
					</div>
					<div class="content">
						<form action="setup_gateway.php" method="POST">
							<div class="row">
								<label>Network</label>
								<div class="right">
                                                                        <select class="ui-selectmenu" name="network">
										<option value="1" <?php if ($row['network']==1) echo 'selected="selected"';?>>CPALead</option>
                                                                                <option value="2"<?php if ($row['network']==2) echo 'selected="selected"';?>>AdscendMedia</option>
                                                                                                                                                                <option value="3"<?php if ($row['network']==3) echo 'selected="selected"';?>>AdworkMedia</option>
									</select>
								</div>
							</div>
							<div class="row">
								<label>Publisher ID</label>
								<div class="right"><input type="text" name="publisher" value="<?php echo $row['publisher_id']; ?>"></div>
							</div>
							<div class="row">
								<label>Gateway ID</label>
								<div class="right"><input type="text" name="gateway" value="<?php echo $row['gateway_id']; ?>"></div>
							</div>
							<div class="row">
								<label>Password</label>
								<div class="right"><input type="text" name="password" value="<?php echo $row['password']; ?>"></div>
							</div>
							<div class="row">
								<div class="right">
								<button type="submit" class="green" name="submit"><span>Submit</span></button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>

<div id="footer">
			<div class="split">Copyright &#169; 2012 - <?php echo $file_path.$file_name; ?> <a href="index.html">Paid4Upload</a>.</div>
			<div class="split right"><a href="http://www.paid4upload.com/forums">Forums</a> | <a href="tos.php">Terms of Service</a> | <a href="dmca.php">DMCA</a></div>
		</div>
	</div>
</div>

</body>


</html> 